<?php

use Illuminate\Database\Seeder;

class AdminsTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        // 生成测试数据 1. 种子 2. 工厂 ctrl + alt + l
        $faker = Faker\Factory::create('zh_CN');
        for ($i = 0; $i < 100; $i++) {
            $data = [
                'username' => $faker->name,
                'password' => bcrypt('admin88'),
                'email' => $faker->email,
                'phoneNumber' => $faker->phoneNumber,
                'is_status' => $faker->boolean,// 转换为 0 或者 1
                'mark_up' => $faker->paragraph,
                'loginIp' => ip2long($faker->ipv4), // 存储ip的时候存储为整数，取的 long2ip即可
                'loginTime' => $faker->numberBetween(0, 300), // 生成一个随机数
            ];
            \App\Http\Models\Admin::create($data);
        }
    }
}
